<?php
/**
 * Created by PhpStorm.
 * User: 驭风者
 * Date: 2019/11/11
 * Time: 9:59
 */
namespace app\index\controller;

use think\Controller;

class getAdds extends Controller
{
    public function getAdds()
    {
        include_once "DB.class.php";

        $data = $_POST;

        $db = new DB("127.0.0.1", "", "root", "root");

        $res = $db->getAdd('news', $data);

        if ($res) {
            echo 'ok';
            header("location:getShow.php", 5);
        } else {
            echo 'no';
        }
    }


    public function getList()
    {
        $page = request()->get('page', 1);
        $limit = request()->get('limit', 10);

        $res = model('New')->getAll( $limit, $page);

        if (!$res) {
            return json(array('code' => 1, 'msg' => '数据错误!!!', 'data' => ''));
        }

        return json(array('code' => 0, 'msg' => 'OK', 'data' => $res));
    }


}
?>